var RunLayer_04_1 = BaseLayer04.extend({
	frame:[],
	num:0,
	no:0,
	curSel:null,
	ctor:function (parent) {
		this._super(parent,5);
		this.init();
	},
	init:function () {
		cc.log("动物细胞的结构初始化");
		this._super();	
		//第一次加载，弹框提示
		this.loadWin();
		this.loadInfo();
		//主按钮点击后效果
		this.loadClick();
		//加载主图（动物细胞）
		this.loadMain();
		if(gg.teach_type == TAG_REAL){
			//实战模式下，随机一个部位闪烁
			this.loadFlash();
			this.loadWord();
		}		
	},
	loadInfo:function(){
		for(var i in teach_flow04){
			var info = teach_flow04[i];
			if(info.tag == TAG_DONGWU){
				//读取Flow里的任务流
				this.frameInfo = info.frameInfo;
				//复制一个数组，做实战中删除用
				this.frame = this.frameInfo.concat();
			}
		}
	},
	loadClick:function(){
		this.button = this.getChildByTag(TAG_BUTTON_DONGWU);
		this.button.setSpriteFrame("help/check.png");
	},
	loadWin:function(){
		if(gg.firstRun){
			gg.synch_l = true;
			var tip = ll.tip.getChildByTag(TAG_TIP);
			tip.setEnable(false);
			var back = ll.tip.getChildByTag(TAG_CLOSE);
			back.setEnable(false);
			var win = new WinFrame(ll.tip,3,"点击右侧结构名称");
			win.open2();
			gg.firstRun = false;
		}					
	},
	loadMain:function(){
		//动物细胞主图
		this.body = new cc.Sprite("#dongwu/body.png");
		this.body.setPosition(cc.p(gg.width*0.43,gg.height*0.5));
		this.body.setScale(1.3);
		if(gg.teach_type == TAG_REAL){
			this.body.setOpacity(50);
		}else {
			this.body.setOpacity(255);
		}	
		this.addChild(this.body);
		var bw = this.body.width;
		var bh = this.body.height;
		for(var i in this.frameInfo){
			var info = this.frameInfo[i];	
			if(!gg.flow.over_flag){
				info.finish = false;
				info.doRight = false;
			}
			var bt = new Button(this.body,10,info.tag,info.img,this.callback,this);
			bt.setPosition(cc.p(info.px, info.py));
			bt.setAnchorPoint(0,1);
			bt.setOpacity(1);
			bt.info = info;
		}
		//加载名称
		this.loadTipFrame();
	},
	callback:function (p){
		this.body.setOpacity(50);
		switch (p.getTag()) {	
		case TAG_DONGWU_XIBAOHE:
		case TAG_DONGWU_XIBAOMO:
		case TAG_DONGWU_XIBAOZHI:
			this.clickCheck(p);
			break;
		default:
			break;
		}
		if(gg.teach_type == TAG_REAL){
			if(!gg.flow.over_flag){
				if(gg.succeed_dongwu){
					this.runAction(cc.sequence(cc.delayTime(1),cc.callFunc(function() {
						gg.flow.next();					
					}, this)));		
				}
			}
		}	
	},
	destroy:function(){
		this._super();
	},
	onExit:function(){
		this._super();
	}
});

